Core.Test.registerTest({
	group: "storage",
	name: "Core.Storage.Dao.compile()",
	
	compile: function(raw) {
		return Core.Storage.Dao.compile(raw);
	},
	
	"Should compile straight local path": function() {
		Assert.equal(
			[false, "path"], 
			this.compile(".path")
		);
	},

	"Should compile straight global path": function() {
		Assert.equal(
			[true, "path"], 
			this.compile("..path")
		);
	},
	
	"Should compile dotted local path": function() {
		Assert.equal(
			[false, "path", "to", "hell"], 
			this.compile(".path.to.hell")
		);
	},
	
	"Should compile dotted global path": function() {
		Assert.equal(
			[true, "path", "to", "hell"], 
			this.compile("..path.to.hell")
		);
	},
	
	"Should compile path with with one closure expression (middle)": function() {
		Assert.equal(
			[false, "path", [false, "to"], "hell"], 
			this.compile(".path{.to}hell")
		);
	},

	"Should compile path with with one closure expression (beggining)": function() {
		Assert.equal(
			[false, [true, "path", "to"], "hell"], 
			this.compile(".{..path.to}hell")
		);
	},
	
	"Should compile path with with one closure expression (end)": function() {
		Assert.equal(
			[false, "path", "to", [true, "hell"]], 
			this.compile(".path.to{..hell}")
		);
	},
	
	"Should compile path with multiple closure expressions (sepparated)": function() {
		Assert.equal(
			[false, "path", [false, "to"], "really", [true, "hell"]], 
			this.compile(".path{.to}really{..hell}")
		);
	},
	
	"Should compile path with multiple closure expressions (besides)": function() {
		Assert.equal(
			[false, "path", [false, "to"], [true, "hell"]], 
			this.compile(".path{.to}{..hell}")
		);
	},
	
	"Should compile path with spaces (1)": function() {
		Assert.equal(
			[false, "path", [false, "to"], [true, "hell"]], 
			this.compile(".path{ .to }{ ..hell }")
		);
	},
	
	"Should compile path with spaces (2)": function() {
		Assert.equal(
			[false, "path", [false, "to"], [true, "hell"]], 
			this.compile(".path {.to} {..hell}")
		);
	},
	
	"Should compile path with recursive closure expressions": function() {
		Assert.equal(
			[false, "path", [true, "nothing", "is", "here"], "to", "hell", [true, "and", [false, "i", "ii", "iii"], "sth"]],
			this.compile(".path{ ..nothing.is.here }to.hell{ ..and{ .i.ii.iii }sth }")
		);
	}
});